package com.wj.im.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@WebServlet(name = "HelloAction", urlPatterns = { "/HelloAction" }, loadOnStartup = 1, initParams = {
		@WebInitParam(name = "name", value = "xiazdong"),
		@WebInitParam(name = "age", value = "20") })
public class WebsocketAction extends HttpServlet {
	private static final long serialVersionUID = -5105537352189629360L;

	protected void service(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		ServletConfig config = getServletConfig();
		HttpSession session = request.getSession();
		PrintWriter out = response.getWriter();
		out.println("<html>");
		out.println("<body>");
		out.println("Hello world" + "<br />");
		out.println("name :" + config.getInitParameter("name") + "<br/>");
		out.println("session id :" + session.getId());
		out.println("</body>");
		out.println("</html>");
		out.close();
	}
}
